using System;

namespace Avanzis.QueryObjects
{
    /// <summary>
    /// Propiedad que representa una primary key
    /// </summary>
    public class PrimaryKeyAttribute : ColumnPropertyAttribute
    {
        private PrimaryKeyType generator;
        /// <summary>
        /// Initializes a new instance of the <see cref="T:PrimaryKey"/> class.
        /// </summary>
        public PrimaryKeyAttribute() : this(PrimaryKeyType.Identity, null)           
        {            
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="T:PrimaryKey"/> class.
        /// </summary>
        /// <param name="fieldName">Name of the field.</param>
        public PrimaryKeyAttribute(String column) : this(PrimaryKeyType.Identity, column)            
        {            
        }

        public PrimaryKeyAttribute(PrimaryKeyType generator)
            : this(generator, null)
        {
            
        }

        public PrimaryKeyAttribute(PrimaryKeyType generator, String column)
        {
            this.Generator = generator;
            this.Column = column;            
        }

        /// <summary>
        /// Gets or sets the generator.
        /// </summary>
        /// <value>The generator.</value>
        public PrimaryKeyType Generator
        {
            get { return generator; }
            set { generator = value; }
        }
    }

    /// <summary>
    /// Tipos de PrimaryKeys
    /// </summary>
    public enum PrimaryKeyType
    {
        Identity,        
        Assigned       
    }
}
